		//当ajax使用时附上csrf_token
		$.ajaxSetup({
		   headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
		});
     　　　　
	    window.onload=function(){
	        echartsData(0);
		}

	    function echartsData(echartsStatus,lineMinRange,lineMaxRange,lineMinYRange,lineMaxYRange){
			require.config({
	            paths: {
	                echarts: 'http://echarts.baidu.com/build/dist'
	            }
	       });
            // 使用
            require(['echarts', 'echarts/chart/line','echarts/chart/bar' ],// 使用柱状图就加载bar模块，按需加载
	            function (ec){
	                // 基于准备好的dom，初始化echarts图表
	                var myChart = ec.init(document.getElementById('polyline'));
	                var option = {
	                	backgroundColor: 'rgba(255,255,255,1)',
					    tooltip : {
					        trigger: 'axis',
					        axisPointer:{
					            show: true,
					            type : 'cross',
					            lineStyle: {
					                type : 'dashed',
					                width : 1
					            }
					        },
					        formatter : function (params) {
					            return params.seriesName + ' : [ '
					                   + params.value[0] + ', '
					                   + params.value[1] + ' ]';
					        }
					    },
					    color:[],
				        legend: {
				        	padding: 15,    // [5, 10, 15, 20]
					        data:[]
					    },
					    toolbox: {
					        show : true,
					        padding:15,
					        itemSize:30,
					        feature : {
	//				            mark : {show: true},
	//				            dataView : {show: true, readOnly: false},
	//				            magicType : {show: true, type: ['line', 'bar']},
					            restore : {
					                show : true,
					                title : '',
					                icon : '/img/Refresh.png',
					                color : 'black'
					            },
					            saveAsImage :{
					                show : true,
					                title : '',
					                icon : '/img/save.png',
					                type : 'jpg',
					                lang : ['点击本地保存']
					            }
					        }
					    },
					    calculable : false,
					    grid:{x:60,x2:30},
					    xAxis : [],
					    yAxis :[],
					    series:[]
					};
//					myChart.setOption(option);
                    myChart.showLoading();    //数据加载完之前先显示一段简单的loading动画
                    var arr = [];
                    var normalArr = [];//结果线数组
                    var lastArr = [];//结果线数组
                    var xAxisArr = [];//获取所有X轴的坐标点
                    var yAxisArr = [];//获取所有Y轴的坐标点
                    var product_id = parseInt(GetRequest());//product_id
					$.ajax({
						// url:'http://www.bunchparty.com/option/public/jsonPaint',
                        url:'jsonPaint',
						type:'post',
						data:{
							product_id:product_id
						},
						success:function(data){
							console.log(JSON.stringify(data));
							if(data){
								for(var i=0;i<data.length;i++){
									for(var j=0;j<data[i].length;j++){
										var json = [data[i][j].x,data[i][j].y];
										arr.push(json);
										xAxisArr.push(data[i][j].x);
										yAxisArr.push(data[i][j].y);
									}
								}
								var lastX=[];
								var lastY=[];
								//获取出结果线之外的的数据计算线,三点定一线
								for(var i=0;i<data.length-1;i++){
									for(var j=0;j<data[i].length;j++){
										var normaljson = [data[i][j].x,data[i][j].y];
										normalArr.push(normaljson);
										if(j%3==1){
											lastX.push(data[i][j].x);
											lastY.push(data[i][j].y);
										}
									}
								}


								//获取结果线
								for(var m=data.length-1;m>data.length-2;m--){
									for(var j=0;j<data[m].length;j++){
										var jsonLast = [data[m][j].x,data[m][j].y];
										lastArr.push(jsonLast);
                                        if(j!=0&&j<=(data[m].length-2)){
											lastX.push(data[m][j].x);
											lastY.push(data[m][j].y);
                                        }
									}
								}
								console.log(JSON.stringify(lastX));
								console.log(JSON.stringify(lastY));

								console.log(JSON.stringify(normalArr));
//								console.log(JSON.stringify(lastArr));
//								console.log(JSON.stringify(xAxisArr));
//								console.log(JSON.stringify(yAxisArr));
								document.getElementById('Max_Profit').innerHTML = Math.ceil((Math.max.apply(null, yAxisArr))/10)*10;
					            document.getElementById('Max_Loss').innerHTML = Math.ceil((Math.min.apply(null, yAxisArr))/10)*10;
					            //给默认设定
					            if(Math.ceil((Math.min.apply(null, lastX)-200)/10)*10<=0){
					            	var defalutX = 0;
					            }else{
					            	var defalutX = Math.ceil((Math.min.apply(null, lastX)-200)/10)*10;
					            }
					            if(Math.ceil((Math.max.apply(null, lastX)+200)/10)*10>=30000){
					            	var defalutMX = 30000;
					            }else{
					            	var defalutMX = Math.ceil((Math.max.apply(null, lastX)+200)/10)*10;
					            }
                                document.getElementById("lineMinRange").value = defalutX;
                                document.getElementById("lineMaxRange").value = defalutMX;
                                document.getElementById("lineMinYRange").value = Math.ceil((Math.min.apply(null, lastY)-200)/10)*10;
                                document.getElementById("lineMaxYRange").value = Math.ceil((Math.max.apply(null, lastY)+200)/10)*10;

                                $('#auto').attr('xAxisMin',defalutX);
                                $('#auto').attr('xAxisMax',defalutMX);
                                $('#auto').attr('yAxisMin',Math.ceil((Math.min.apply(null, lastY)-200)/10)*10);
                                $('#auto').attr('yAxisMax',Math.ceil((Math.max.apply(null, lastY)+200)/10)*10);

//								console.log(JSON.stringify(arr));
								var newArr = []; //切割数组,
								var s = parseInt(normalArr.length / 3);
                                var n=0;
                                for (var i = 1; i <= s; i++) {
								    var star = (i - 1) * 3;
								    newArr[n++] = normalArr.slice(star, star + 3);
								}
                                newArr[n++] = lastArr;
//                              var y = normalArr.length - s * 3;
//                              if (y > 0) {
//								    newArr[n++] = arr.slice(s * 3);
//								}
//                              console.log(JSON.stringify(newArr));
                                var legendData = [];
                                for(var i=0;i<newArr.length;i++){
                                	var dataName = 'line'+i;
                                	if(i==newArr.length-1){
                                		var lastName = {name:dataName,textStyle:{color:'#000000'}};
                                		legendData.push(lastName);
	                                	var item = {
	                            	    	symbol:'none',
	                            	    	clickable: false,
	                            	    	name:dataName,
	                            	    	type:'line',
	                            	    	data:newArr[i]
	                            	    };
                                	}else{
                                		legendData.push(dataName);
	                                	var item = {
	                            	    	symbol:'none',
	                            	    	clickable: false,
	                            	    	name:dataName,
	                            	    	smooth:false,
	                            	    	itemStyle : {  /*设置折线颜色*/
												normal : {
													lineStyle: {
														width:1,
														type:'dashed' //线条样式，虚线
													}
												}
											},
	                            	    	type:'line',
	                            	    	data:newArr[i]
	                            	    };
                                	}
                            	    option.legend.data.push(dataName);
                            	    option.series.push(item);
                                }
                               //设置legend的颜色以及样式,结果线为黑色
                                for(var i=0;i<newArr.length;i++){
                                	if(i==newArr.length-1){
                                		var color="#000000";
                                	}else{
                                		var color="#";
	                                	for(var j=0;j<6;j++){
											color += (Math.random()*16 | 0).toString(16);
										}
                                	}
                                	option.color.push(color);
                                }
                                //console.log(JSON.stringify(legendData));
                                //设置yAxis
                                myChart.hideLoading();
                                if(echartsStatus==0){
                                    $('#oneTable').bootstrapTable('refresh', {url: 'jsonTable'});
                                	if(Math.ceil((Math.min.apply(null, lastX)-200)/10)*10<=0){
						            	var xAxisMin = 0;
						            }else{
						            	var xAxisMin = Math.ceil((Math.min.apply(null, lastX)-200)/10)*10;
						            }
                                    var xAxisMax = Math.ceil((Math.max.apply(null, lastX)+200)/10)*10;
                                	var yAxisMin = Math.ceil((Math.min.apply(null, lastY)-200)/10)*10;
                                	var yAxisMax = Math.ceil((Math.max.apply(null, lastY)+200)/10)*10;
                                	common(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                	changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                }else if(echartsStatus==2){
                                   var xmin = Math.ceil((parseInt(lineMinRange)+parseInt(50))/10)*10;
                                   var xmax = Math.ceil((parseInt(lineMaxRange)-parseInt(50))/10)*10;
                                   var ymin = Math.ceil((parseInt(lineMinYRange)+parseInt(50))/10)*10;
                                   var ymax = Math.ceil((parseInt(lineMaxYRange)-parseInt(50))/10)*10;

                                   if(Math.ceil((parseInt(lineMinRange)+parseInt(50))/10)*10>=30000){
						            	var xAxisMin = 30000;
						            }else if(xmin>=xmax){
						            	var xAxisMin = Math.ceil(parseInt(lineMinRange)/10)*10;//当最大值与最小值一样时,还原数据
						            }else{
						            	var xAxisMin = Math.ceil((parseInt(lineMinRange)+parseInt(50))/10)*10;
						            }

                                   if(Math.ceil((parseInt(lineMaxRange)-parseInt(50))/10)*10>=30000){
						            	var xAxisMax = 30000;
						            }else if(xmin>=xmax){
						            	var xAxisMax = Math.ceil(parseInt(lineMaxRange)/10)*10;//当最大值与最小值一样时,还原数据
						            }else{
						            	var xAxisMax = Math.ceil((parseInt(lineMaxRange)-parseInt(50))/10)*10;
						            }

						            if(ymin>=ymax){
						               var yAxisMin = Math.ceil(parseInt(lineMinYRange)/10)*10;
                                       var yAxisMax = Math.ceil(parseInt(lineMaxYRange)/10)*10;
						            }else{
						               var yAxisMin = Math.ceil((parseInt(lineMinYRange)+parseInt(50))/10)*10;
                                       var yAxisMax = Math.ceil((parseInt(lineMaxYRange)-parseInt(50))/10)*10;
						            }
                                	common(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                	changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                }else if(echartsStatus==3){
                                	if(Math.ceil((parseInt(lineMinRange)-parseInt(50))/10)*10<=0){
						            	var xAxisMin = 0;
						            }else{
						            	var xAxisMin = Math.ceil((parseInt(lineMinRange)-parseInt(50))/10)*10;
						            }
                                   if(Math.ceil((parseInt(lineMaxRange)+parseInt(50))/10)*10>=30000){
						            	var xAxisMax = 30000;
						            }else{
						            	var xAxisMax = Math.ceil((parseInt(lineMaxRange)+parseInt(50))/10)*10;
						            }
                                   var yAxisMin = Math.ceil((parseInt(lineMinYRange)-parseInt(50))/10)*10;
                                   var yAxisMax = Math.ceil((parseInt(lineMaxYRange)+parseInt(50))/10)*10;

                                	common(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                	changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                }else if(echartsStatus==4){
                                	var xAxisMin = Math.ceil(lineMinRange/10)*10;
                                	var xAxisMax = Math.ceil(lineMaxRange/10)*10;
                                	var yAxisMin = Math.ceil(lineMinYRange/10)*10;
                                	var yAxisMax = Math.ceil(lineMaxYRange/10)*10;
                                	common(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                	changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                }else{
                                	if(lineMinRange==""||lineMinRange==0){
                                		var xAxisMin = Math.ceil((Math.min.apply(null, xAxisArr))/10)*10;
                                	}else{
                                		var xAxisMin = Math.ceil((lineMinRange)/10)*10;
                                	}
                                	if(lineMaxRange==""||lineMaxRange==0){
                                		var xAxisMax = Math.ceil((Math.max.apply(null, xAxisArr))/10)*10;
                                	}else{
                                		var xAxisMax = Math.ceil((lineMaxRange)/10)*10;
                                	}
                                	if(lineMinYRange==""||lineMinYRange==0){
                                		var yAxisMin = Math.ceil((Math.min.apply(null, yAxisArr))/10)*10;
                                	}else{
                                		var yAxisMin = Math.ceil((lineMinYRange)/10)*10;
                                	}
                                	if(lineMaxYRange==""||lineMaxYRange==0){
                                		var yAxisMax = Math.ceil((Math.max.apply(null, yAxisArr))/10)*10;
                                	}else{
                                		var yAxisMax = Math.ceil((lineMaxYRange)/10)*10;
                                	}
                                	common(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                	changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax);
                                }
//                              console.log('xAxisMin'+xAxisMin);
//                              console.log('xAxisMax'+xAxisMax);
//                              console.log('yAxisMin'+yAxisMin);
//                              console.log('yAxisMax'+yAxisMax);
                                //设置X,Y轴的属性
                                myChart.setOption({
                                	xAxis:[
                                	    {
								            type : 'value',
								            min:xAxisMin,
								            max:xAxisMax,
					                        scale: true,
								            axisLine: {
								                lineStyle: {
								                    color: '#657eff'
								                }
								            }
								        }
                                	],
                                	yAxis:[
	                                	    {
								            type : 'value',
								            min:yAxisMin,
								            max:yAxisMax,
								            axisLine: {
								                lineStyle: {
								                    color: '#657eff'
								                }
								            }
								        }
                                	]
                                });
                                myChart.setOption(option);
							}
						},
						error:function(error){
//							console.log(JSON.stringify(error));
							myChart.hideLoading();
						}
					});

	           }
	        );

	    }

	    //公共的
	    function common(xAxisMax,xAxisMin,yAxisMin,yAxisMax){
	        $('#zoomIn').attr('Max',xAxisMax);
	    	$('#zoomIn').attr('Min',xAxisMin);
	    	$('#zoomIn').attr('YMax',yAxisMax);
	    	$('#zoomIn').attr('YMin',yAxisMin);

	    	$('#zoomOut').attr('Max',xAxisMax);
	    	$('#zoomOut').attr('Min',xAxisMin);
	    	$('#zoomOut').attr('YMax',yAxisMax);
	    	$('#zoomOut').attr('YMin',yAxisMin);
	    }

        //返回默认
        function backAuto(){
            var xAxisMin = $('#auto').attr('xAxisMin');
            var xAxisMax = $('#auto').attr('xAxisMax');
            var yAxisMin = $('#auto').attr('yAxisMin');
            var yAxisMax = $('#auto').attr('yAxisMax');
            echartsData(4,xAxisMin,xAxisMax,yAxisMin,yAxisMax);
        };

        //实时改变输入框的值
        function changeTime(xAxisMax,xAxisMin,yAxisMin,yAxisMax){
            document.getElementById("lineMinRange").value =xAxisMin;
            document.getElementById("lineMaxRange").value = xAxisMax;
            document.getElementById("lineMinYRange").value = yAxisMin;
            document.getElementById("lineMaxYRange").value = yAxisMax;
        }

	    //改变X轴刻度
	    function changeXaxis(){
	    	var lineMinRange = document.getElementById('lineMinRange').value;
	    	var lineMaxRange = document.getElementById('lineMaxRange').value;
	    	var lineMinYRange = document.getElementById('lineMinYRange').value;
	    	var lineMaxYRange = document.getElementById('lineMaxYRange').value;
	    	echartsData(1,lineMinRange,lineMaxRange,lineMinYRange,lineMaxYRange);
	    }

	    //放大
	    function zoomIn(obj){
	       var Max = $('#zoomIn').attr('Max');
	       var Min = $('#zoomIn').attr('Min');
	       var YMax = $('#zoomIn').attr('YMax');
	       var YMin = $('#zoomIn').attr('YMin');
	       echartsData(2,Min,Max,YMin,YMax);
	    }
	    //缩小
	    function zoomOut(obj){
	       var Max = $('#zoomOut').attr('Max');
	       var Min = $('#zoomOut').attr('Min');
	       var YMax = $('#zoomOut').attr('YMax');
	       var YMin = $('#zoomOut').attr('YMin');
	       echartsData(3,Min,Max,YMin,YMax);
	    }
	    window.onresize=function(){//当窗口改变宽度时执行此函数
	        var myChart = echarts.init(document.getElementById('polyline'));
	    	myChart.resize();
	    	changeXaxis();
	    	$('#myTable').bootstrapTable('resetView');
	    	$('#oneTable').bootstrapTable('resetView');
	    	$('#twoTable').bootstrapTable('resetView');
	    }

	   /*第一个表格*/
		function DoOnCellHtmlData(cell, row, col, data) {
		    var result = "";
		    if (typeof data != 'undefined' && data != "") {
		       var html = $.parseHTML(data);
		        $.each( html, function() {
		            if ( typeof $(this).html() === 'undefined' )
		                result += $(this).text();
		            else if ( typeof $(this).attr('class') === 'undefined' || $(this).hasClass('th-inner') === true )
		                result += $(this).html();
		        });
		    }
		    return result;
		}
		$(document).ready(function() {
			$('#myTable').bootstrapTable('refreshOptions', {
		        exportOptions: {
		        	ignoreColumn: ['0','checkbox'], // or as string array: ['0','checkbox']
		            onCellHtmlData: DoOnCellHtmlData
		        }
		    });
		    $('#oneTable').bootstrapTable('refreshOptions', {
		        exportOptions: {
		        	ignoreColumn: ['0','checkbox'], // or as string array: ['0','checkbox']
		            onCellHtmlData: DoOnCellHtmlData
		        }
		    });
		    $('#twoTable').bootstrapTable('refreshOptions', {
		        exportOptions: {
		        	ignoreColumn: ['0','checkbox'], // or as string array: ['0','checkbox']
		            onCellHtmlData: DoOnCellHtmlData
		        }
		    });
		    $("div.tabulation_one .bootstrap-table .fixed-table-container thead div.th-inner").eq(1).addClass("dpn");
		    $("div.tabulation_Two .bootstrap-table .fixed-table-container thead div.th-inner").eq(1).addClass("dpn");
			//oneTableIndex ();
			//twoTableIndex ();
		});

        //给oneTable第一个表格增加编辑和增加按钮
        function actionFormatter(value, row, index) {
		    return [
		        '<a id="btn_detail">Delete</a>'+
		        '<a id="btn_Edit">Edit</a>'
		    ].join('');
		}
        //给twoTable第二个表格增加编辑和增加按钮
        function actionTwoFormatter(value, row, index) {
		    return [
		        '<a id="btn_two_detail">Delete</a>'+
		        '<a id="btn_two_Edit">Edit</a>'
		    ].join('');
		}

        //oneTable第一个表格删除一行
        window.actionEvents = {
		    'click #btn_detail': function (e, value, row, index) {
		        // alert('You click like icon, row: ' + JSON.stringify(row.id));
		        $.ajax({
		        	url:'/options/'+row.id,
		        	type:'delete',
		        	success:function(data){
		        		console.log(data);
		        		//刷新表格
		        		$('#oneTable').bootstrapTable('refresh', {url: 'jsonTable'});
		        		echartsData();//刷新折线图
		        	},
		        });
		    },
		    'click #btn_Edit': function (e, value, row, index) {
		    	$(".oneEdit_form select[name=Product] option").each(function(){
              		if($(this).val()==row.Product){
                     $(this).attr("selected",true);
	                }
	            });
	            $(".oneEdit_form select[name=CallPut] option").each(function(){
              		if($(this).val()==row.CallPut){
                     $(this).attr("selected",true);
	                }
	            });
	            $(".oneEdit_form select[name=LongShort] option").each(function(){
              		if($(this).val()==row.LongShort){
                     $(this).attr("selected",true);
	                }
	            });
	            $(".oneEdit_form select[name=Ultimate] option").each(function(){
              		if($(this).val()==row.Ultimate){
                     $(this).attr("selected",true);
	                }
	            });
	            //pid
			    $('.oneEdit_form input[name=id]').attr('value',row.id);
	            //日期
			    $('.oneEdit_form input[name=TradingDate]').attr('value',row.TradingDate);
			    //行使价
			    $('.oneEdit_form input[name=ExercisePrice]').attr('value',row.ExercisePrice);
			    //？？
			    $('.oneEdit_form input[name=Premium]').attr('value',row.Premium);
			    //？？
			    $('.oneEdit_form input[name=Qty]').attr('value',row.Qty);

                $(".addRow").addClass('dpn');
                $('.editRow').removeClass('dpn');
                $('.twoEdit_form').addClass('dpn');
                $('.oneEdit_form').removeClass('dpn');
		        $('.editBox').removeClass('dpn');
		    }
		};

        //twoTable第二个表格删除一行
        window.actionTwoEvents = {
		    'click #btn_two_detail': function (e, value, row, index) {
		        // alert('You click like icon, row: ' + JSON.stringify(row.id));
		        $.ajax({
		        	url:'/options/'+row.id,
		        	type:'delete',
		        	success:function(data){
		        		console.log(data);
		        		//刷新表格
		        		$('#twoTable').bootstrapTable('refresh', {url: 'jsonExport'});
                        echartsData();//刷新折线图

		        	},
		        });
		    },
		    'click #btn_two_Edit': function (e, value, row, index) {
		    	$(".twoEdit_form select[name=Product] option").each(function(){
              		if($(this).val()==row.Product){
                     $(this).attr("selected",true);
	                }
	            });
	            $(".twoEdit_form select[name=LongShort] option").each(function(){
              		if($(this).val()==row.LongShort){
                     $(this).attr("selected",true);
	                }
	            });
	            $(".twoEdit_form select[name=Ultimate] option").each(function(){
              		if($(this).val()==row.Ultimate){
                     $(this).attr("selected",true);
	                }
	            });

			    $('.twoEdit_form input[name=id]').val(row.id);
			    $('.twoEdit_form input[name=TradingDate]').attr('value',row.TradingDate);
			    $('.twoEdit_form input[name=ExercisePrice]').attr('value',row.ExercisePrice);
			    $('.twoEdit_form input[name=Qty]').attr('value',row.Qty);

                $(".addTwoRow").addClass('dpn');
                $('.editTwoRow').removeClass('dpn');
                $('.oneEdit_form').addClass('dpn');
                $('.twoEdit_form').removeClass('dpn');
		        $('.editBox').removeClass('dpn');
		    }
		};

       //status=1->第一个表格编辑数据   status=0->表示给表格添加数据
		function editOneTable(status){
			var product_id = parseInt(GetRequest());//product_id

            var id = $(".oneEdit_form input[name=id]").val();//获取ID
            var TradingDate = $(".oneEdit_form input[name=TradingDate]").val();//获取ID
            var ExercisePrice = $(".oneEdit_form input[name=ExercisePrice]").val();//获取ID
            var Premium = $(".oneEdit_form input[name=Premium]").val();//获取ID
            var Qty = $(".oneEdit_form input[name=Qty]").val();//获取ID


            var Product = $('.oneEdit_form select[name=Product] option:selected').val();
            var CallPut = $('.oneEdit_form select[name=CallPut] option:selected').val();
            var LongShort = $('.oneEdit_form select[name=LongShort] option:selected').val();
            var Ultimate = $('.oneEdit_form select[name=Ultimate] option:selected').val();
            if(status==1){
                // var url = '/options';
                var url = '/option/public/options';
                var type = 'patch';
                var data = {id:id,TradingDate:TradingDate,ExercisePrice:ExercisePrice,Premium:Premium,Qty:Qty,Product:Product,CallPut:CallPut,LongShort:LongShort,Ultimate:Ultimate};
            }else{
                // var url = '/options';
                var url = '/option/public/options';
                var type = 'post';
                var data = {type:1,product_id:product_id,id:id,TradingDate:TradingDate,ExercisePrice:ExercisePrice,Premium:Premium,Qty:Qty,Product:Product,CallPut:CallPut,LongShort:LongShort,Ultimate:Ultimate};
            }
            $.ajax({
            	url:url,
            	type:type,
            	data:data,
            	success:function(data){
            	   console.log(data);
            	   if(data==1){
            	   	    $('#oneTable').bootstrapTable('refresh', {url: 'jsonTable'});
        	            $('.editBox').addClass('dpn');
        	            echartsData();//刷新折线图
            	   }
            	}
            });
		}

        //status=1->第二个表格编辑数据   status=0->表示给表格添加数据
		function editTwoTable(status){
			var product_id = parseInt(GetRequest());//product_id

            var id = $(".twoEdit_form input[name=id]").val();
            var TradingDate = $(".twoEdit_form input[name=TradingDate]").val();
            var ExercisePrice= $(".twoEdit_form input[name=ExercisePrice]").val();
            var Qty = $(".twoEdit_form input[name=Qty]").val();
            var Product = $('.twoEdit_form select[name=Product] option:selected').val();
            var LongShort = $('.twoEdit_form select[name=LongShort] option:selected').val();
            var Ultimate = $('.twoEdit_form select[name=Ultimate] option:selected').val();

            if(status==1){
                // var url = '/options';
                var url = '/option/public/options'; //编辑表格数据接口
                var type = 'patch';
                var data = {id:id,TradingDate:TradingDate,ExercisePrice:ExercisePrice,Qty:Qty,Product:Product,LongShort:LongShort,Ultimate:Ultimate};
            }else{
                // var url = '/options';
                var url = '/option/public/options';  //编辑表格数据接口
                var type = 'post';
                var data = {product_id:product_id,type:2,id:id,TradingDate:TradingDate,ExercisePrice:ExercisePrice,Qty:Qty,Product:Product,LongShort:LongShort,Ultimate:Ultimate};
            }
            $.ajax({
            	url:url,
            	type:type,
            	data:data,
            	success:function(data){
            		// console.log(data);
            	   if(data==1){
            	   	    $('#twoTable').bootstrapTable('refresh', {url: 'jsonExport'});
        	            $('.editBox').addClass('dpn');
        	            echartsData();//刷新折线图
            	   }
            	},
            	error:function(request){//请求失败之后的操作
                    alert('操作失败');
                }
            });
		}
	//给第一个表格增加一行
    function addH(status){
    	if(status==0){
        	$('.editRow').addClass('dpn');
            $('.addRow').removeClass('dpn');
            $('.twoEdit_form').addClass('dpn');
            $('.oneEdit_form').removeClass('dpn');
		    $('.editBox').removeClass('dpn');
    	}else{
            $(".addTwoRow").removeClass('dpn');
            $('.editTwoRow').addClass('dpn');
            $('.oneEdit_form').addClass('dpn');
            $('.twoEdit_form').removeClass('dpn');
	        $('.editBox').removeClass('dpn');
    	}
    }
    //点击关闭编辑页
    function cancelEdit(){
    	$('.editBox').addClass('dpn');
    }

    //选中当前页面所有checkbox或者取消全部选中0->oneTable 1->twoTable
    function checkAll(status){
       var oneSelectAll = document.getElementById('oneSelectAll');
       var twoSelectAll = document.getElementById('twoSelectAll');
       if(status==0){
           if(oneSelectAll.checked){
           	  $('#oneTable').bootstrapTable("checkAll");
           }else{
           	  $('#oneTable').bootstrapTable("uncheckAll");
           }
       }else{
           if(twoSelectAll.checked){
           	  $('#twoTable').bootstrapTable("checkAll");
           }else{
           	  $('#twoTable').bootstrapTable("uncheckAll");
           }
       }

    }

     //获取表格所有数据select group 选择0->oneTable 1->twoTable
     function getAllData(status){
     	var ArrOne = $('#oneTable').bootstrapTable('getData');
     	var ArrTwo = $('#twoTable').bootstrapTable('getData')
     	var selectedOne = $('#select_blank option:selected').val();
     	var selectedTwo = $('#two_select option:selected').val();
     	if(status==0){
	        for(var i=0;i<ArrOne.length;i++){
	     		if(selectedOne==ArrOne[i].Ultimate){
	     			$('#oneTable').bootstrapTable('check',i);
	     		}else{
	     			$('#oneTable').bootstrapTable('uncheck',i);
	     		}
	     	}
     	}else{
	        for(var i=0;i<ArrTwo.length;i++){
	     		if(selectedTwo==ArrTwo[i].Ultimate){
	     			$('#twoTable').bootstrapTable('check',i);
	     		}else{
	     			$('#twoTable').bootstrapTable('uncheck',i);
	     		}
	     	}
     	}
     }

function GetRequest() {
   return $('#product_id').val();
}

